package com.rawchen.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @Description: 访客记录
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Visitor {
	@TableId(type = IdType.AUTO)
	private Long id;
	/** 访客标识码 */
	private String uuid;
	/** ip */
	private String ip;
	/** ip来源 */
	private String ipSource;
	/** 操作系统 */
	private String os;
	/** 浏览器 */
	private String browser;
	/** 首次访问时间 */
	private Date createTime;
	/** 最后访问时间 */
	private Date lastTime;
	/** 访问页数统计 */
	private Integer pv;
	private String userAgent;

	public Visitor(String uuid, String ip, String userAgent) {
		this.uuid = uuid;
		this.ip = ip;
		Date date = new Date();
		this.createTime = date;
		this.lastTime = date;
		this.pv = 0;
		this.userAgent = userAgent;
	}
}
